<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <body>


        <ui:composition template="./WEB-INF/template.xhtml">

            <ui:define name="pageTitle">
                Leases report
            </ui:define>

            <ui:define name="content">
                <f:view>
                    <h:form>
                        <h1><h:outputText value="Leases of #{bookBean.b}"/></h1>
                        <h:commandLink action="book-report-leases-csv.xhtml" actionListener="#{leaseBean.exportCsv()}">
                            Export to CSV
                            <f:param name="bid" value="#{param.bid}"/>
                            <f:param name="id" value="#{param.bid}"/>
                        </h:commandLink>
                        <h:dataTable value="#{leaseBean.leasesByBook}" var="item">
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Id"/>
                                </f:facet>
                                <h:outputText value="#{item.id}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="LeaseDt"/>
                                </f:facet>
                                <h:outputText value="#{item.leaseDt}">
                                    <f:convertDateTime pattern="MM/dd/yyyy" />
                                </h:outputText>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="ReturnDt"/>
                                </f:facet>
                                <h:outputText value="#{item.returnDt}">
                                    <f:convertDateTime pattern="MM/dd/yyyy" />
                                </h:outputText>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Completed"/>
                                </f:facet>
                                <h:outputText value="#{item.completed}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Reader"/>
                                </f:facet>
                                <h:outputText value="#{item.reader}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Exemplar"/>
                                </f:facet>
                                <h:outputText value="#{item.exemplar}"/>
                            </h:column>
                        </h:dataTable>
                    </h:form>
                </f:view>

            </ui:define>

        </ui:composition>

    </body>
</html>
